package work.dp;

/**
 * @author WDH
 * @description
 * @date 2024年12月03日 19:33
 */

public class Problem343 {

    public int integerBreak(int n) {
        int[] dp = new int[n + 1];
        dp[0] = 0;

        for (int i = 1; i <= n; i++) {
            dp[i] = 0;
        }
        dp[1] = 1;
        for (int i = 2; i <= n; i++) {
            for (int j = 1; j <i; j++) {
                int tag = Math.max(j * (i - j), j * dp[i - j]);
                dp[i] = Math.max(tag, dp[i]);
                System.out.println(i + "++++" + dp[i]);
            }
        }
        return dp[n];
    }

    public static void main(String[] args) {
        Problem343 problem343 = new Problem343();
        problem343.integerBreak(4);
    }

}
